All Functions Used So Far, Week 4

matrix

{base}

Creates a matrix from the given set of values.

as.integer

{base}

Convert an object to integer values

prop.table

{base}

Transform frequency table into table of proportions

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

sum

{base}

Get sum of numeric values or a vector

select

{dplyr}

Select columns from a tibble/data frame

mutate

{dplyr}

Create new variables

correlation_matrix

{corrtable}

Create a formatted correlation matrix of variables

datasummary

{modelsummary}

Create customizable summary-statistics tables

data.frame

{base}

Create a data.frame from vectors

mean

{base}

Get mean of a vector

round

{base}

Rounds numbers

factor

{base}

Create a factor

geom_point

{GGPLOT2}

Generates a scatter plot

replace

{base}

Replace elements in a vector

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

element_blank

{GGPLOT2}

This theme element draws nothing, and assigns no space

read_excel

{readxl}

Read an Excel file

library

{base}

Load an R package

labs

{GGPLOT2}

Customise labels in GGPLOT2

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

scale_y_continuous

{GGPLOT2}

Customise continuous y axis

setwd

{base}

Set Working Directory

sd

{stats}

Get standard deviation of a vector

margin

{GGPLOT2}

Set margins around plot elements (used inside theme elements)

summary

{base}

Obtain summary statistics or detailed regression output

element_text

{GGPLOT2}

Customise text in GGPLOT2

cut

{base}

Convert Numeric to Factor

geom_jitter

{GGPLOT2}

Add randomly displaced points to reduce overplotting

c

{base}

Combine values/vectors into a vector

is.na

{base}

Check if a value is NA/elements of vector are NA

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

filter

{dplyr}

Filter out rows of a data frame according to logical vector

read_csv

{readr}

Read CSV files

ggplot

{GGPLOT2}

Create a ggplot graph

pwr.r.test

{pwr}

Power analysis for correlation tests

geom_smooth

{GGPLOT2}

Generates a smoothed conditional means curve / line

theme

{GGPLOT2}

Customize ggplot themes

write.csv

{utils}

write a csv file to a data frame

as.character

{base}

Coerce a vector to character

lm

{stats}

Fit linear models using least squares

factor

{base}

Create factor variables

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

as.numeric

{base}

Coerce a vector to numeric

recode

{dplyr}

Recode a variable

vdem

{vdemdata}

V-Dem country-year dataset

with

{base}

evaluate expression in the context of a data frame

chisq.test

{stats}

Chi-Squared test (e.g. for cross-tabulations)

complete.cases

{stats}

Find Complete Cases

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

cor.test

{stats}

Test for Association/Correlation Between Paired Samples

The end!